<template>
	<view class="pictureWords">
		<view class="header" :style="{ height: globalData.statusBarHeight + globalData.toBar + 10 + 'px' }">
			<view class="title" :style="{ top: globalData.statusBarHeight + 'px', height: globalData.toBar + 'px', lineHeight: globalData.toBar + 'px' }">
				<uni-nav-bar backgroundColor="transparent" title="修改计划" left-icon="left" @clickLeft="goback" />
			</view>
		</view>

		<view class="content">
			<view class="content-title">
				<h3 class="h3title">正在学习</h3>
				<!-- <view class="changeBook" @click="changeBook">更换词书</view> -->
			</view>
			<!-- //词书部分 -->
			<view class="book">
				<view class="book-header">
					<view class="header-left">
						<img src="" alt="" style="width: 136rpx; height: 162rpx" />
						<view class="img-title">四级真题核心词</view>
					</view>

					<view class="header-right">
						<h3 class="header-right-h3" style="font-size: 32rpx">四级真题核心词</h3>
						<progress percent="20" stroke-width="6" border-radius="3" activeColor="rgba(15, 176, 155, 1)" />
						<view class="right-bottom">
							<span>已学习 50</span>
							<span>总词数 2000</span>
						</view>
					</view>
				</view>
				<view class="book-content"></view>
			</view>
		</view>
	</view>
</template>

<script>
export default {
	data() {
		return {
			globalData: null,
			contentHeight: 0
		};
	},
	created() {
		// 在组件创建时获取 globalData
		try {
			this.globalData = wx.getStorageSync('globalData');
			this.calculateContentHeight();
		} catch (error) {
			// 处理获取存储失败的情况
			console.error('Failed to get globalData from storage:', error);
		}
	},
	onLoad(options) {},

	methods: {
		goback() {
			uni.navigateBack();
		},
		calculateContentHeight() {
			const statusBarHeight = this.globalData.statusBarHeight;
			const toBarHeight = this.globalData.toBar;
			const additionalHeight = 100; // 额外的 60px

			// 计算内容高度
			const contentHeight = `calc(100vh - (${statusBarHeight}px + ${toBarHeight}px + ${additionalHeight}px))`;

			this.contentHeight = contentHeight;
		}
	}
};
</script>

<style scoped lang="scss">
.pictureWords {
	height: 100vh;
	.header {
		width: 100%;
		// height: 360rpx;

		background-color: #fff;
		overflow: hidden;
		.status_bar {
			height: var(--status-bar-height);
			width: 100%;
		}
		.title {
			position: absolute;
			width: 100%;
			left: 50%;
			/* top: 20px; */
			transform: translate(-50%, 0);
			color: white;
			font-size: 32rpx;
		}
	}

	.content {
		padding: 24rpx;
		background-color: rgba(255, 255, 255, 1);
		.content-title {
			display: flex;
			align-items: center;
			justify-content: space-between;
			.h3title {
				font-size: 36rpx;
			}
			.changeBook {
				width: 160rpx;
				height: 60rpx;
				background: #dcf5ed;
				border-radius: 32rpx;
				text-align: center;
				font-size: 28rpx;
				color: #0fb09b;
				line-height: 60rpx;
			}
		}
		.book {
			margin-top: 24rpx;
			// width: 702rpx;

			.book-header {
				border: 2rpx solid #edeff2;
				background: #fafbfc;
				padding: 32rpx 32rpx 40rpx 32rpx;
				display: flex;
				border-radius: 24rpx;
				border-bottom: 1px solid rgba(235, 235, 235, 1);
				.header-left {
					position: relative;
					.img-title {
						position: absolute;
						top: 14rpx;
						left: 14rpx;
						font-size: 18rpx;
					}
				}
				.header-right {
					margin-left: 24rpx;
					flex: 1;
					.header-right-h3 {
						margin-bottom: 76rpx;
					}

					.right-bottom {
						font-size: 20rpx;
						color: rgba(153, 153, 153, 1);
						margin-top: 16rpx;
						display: flex;
						align-items: center;
						justify-content: space-between;
					}
				}
			}

			.book-content {
				border: 2rpx solid #edeff2;
				background: #fafbfc;
				padding: 32rpx 32rpx 40rpx 32rpx;
				height: 420rpx;
				border-radius: 24rpx;
				margin-top: 24rpx;
				border-bottom: 1px solid rgba(235, 235, 235, 1);
			}
		}
	}

	::v-deep {
		.uni-navbar--border {
			border-bottom-color: transparent !important;
		}
		.wu-cell__body {
			padding: 10px 0 !important ;
		}
		.wu-calendar__header {
			display: none !important;
		}

		.wu-calendar-item__weeks-box-item .data-v-162ccb5d {
			height: 48rpx !important;
			border-radius: 50% !important;
		}

		.wu-calendar-item__weeks-lunar-text.data-v-162ccb5d {
			display: none !important;
		}
	}
}
</style>
